package com.wxf.selectionSort;

import com.wxf.utils.CompareUtil;

public class SelectionSort {
    public static void sort(Comparable[] arr){
        int N = arr.length;
        for(int i=0; i<N; i++){
            int min = i;
            for(int j=i+1; j<N; j++){
                if(CompareUtil.less(arr[j], arr[min]))
                    min = j;
            }
            CompareUtil.exchange(arr, min, i);
        }
    }

}